/* 
 * File:   alegrid.h
 * Author: boyan
 *
 * Created on January 15, 2008, 9:44 AM
 */

#ifndef _ALEGRID_H
#define	_ALEGRID_H

#include "glodef.h"
#include "grid3d.h"
#include "vecs.h"

typedef struct {
    grid3d_t *grid; /* contains the current positions of nodes */
    node_t *ref_nodes; /* reference positions of nodes */
    node_t *old_nodes; /* previous positions of nodes */
    vector ndisp; /* node displacements (nodal values, i.e. in p1) */
    int *can_move; /* indicates which nodes can move in QGrid */
    void *alebc_data;
    void *laplace_data;
} alegrid_t;



#ifdef	__cplusplus
extern "C" {
#endif

    alegrid_t *init_alegrid(grid3d_t *grid);
    void done_alegrid(alegrid_t *alegrid);
    void set_ref_nodes(alegrid_t *ag, node_t *new_ref_nodes);

    /* here the desired positions of boundary nodes are set by prior calls to
       SetALEBCxxx routine(s) */
    void move_alegrid_laplace(alegrid_t *ag, double time);

    /* here the desired positions of boundary nodes are given in vector bnpos */
    void move_alegrid_laplace_bnpos(alegrid_t *ag, double time, vector bnpos);

    vector get_ndisp(alegrid_t *alegrid);

    void SetALEBCString(alegrid_t *ag, unsigned on_bdry, const char *ptpos_s);
    void SetALEBCRoutine(alegrid_t *ag, unsigned on_bdry, field3d *ptpos_r);


#ifdef	__cplusplus
}
#endif

#endif	/* _ALEGRID_H */

